import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:smartloan_mdc/extension/extension.dart';
import 'package:smartloan_mdc/pages/widgets/term.dart';
import 'package:smartloan_mdc/res/string.dart';

import '../widgets/base_page.dart';

abstract class BaseAuth extends BasePage {
  const BaseAuth({super.key});

  @override
  BasePageState<BasePage> getState() => getBaseAuthState();

  BaseAuthState getBaseAuthState();
}

abstract class BaseAuthState<T extends BaseAuth> extends BasePageState<BaseAuth> {

  bool isAgree = true;

  @override
  Widget buildWidget() {
    return Container(
      child: Column(
        children: [
          Stack(
            children: [
              Container(
                // color: Colors.amber,
                // height: 150.h,
                width: ScreenUtil().screenWidth,
                child: "auth_banner".appImg(fit: BoxFit.contain),
              ),
              Positioned(
                left: 30.w,
                top: 0,
                bottom: 0,
                right: 55.w,
                child: Center(
                  child: AppStr.authTitle.sText(
                    color: Colors.white,
                    fontSize: 24,
                    fontWeight: FontWeight.bold
                  ),
                )
              )
            ],
          ),
          Expanded(
            child: buildContent()
          ),
          Term(
            isAgree: isAgree,
            checkBoxOnPress: (value) {
              setState(() {
                isAgree = value;
              });
            },
          ).marginSymmetric(horizontal: 15.w),
          30.h.hSizedBox(),
        ],
      ),
    );
  }

  Widget buildContent();

  bool get getAgree => isAgree;

}
